﻿//------------------------------------------------------------------------------------------------- 
// <copyright file="PluggableForAttribute.cs" company="Christopher Hines">
// Copyright (c) Christopher Hines. All rights reserved.
// </copyright>
// <summary>
//    Filters a decorated class as only able to satisfy certain values of a specific context type
// </summary>
//-------------------------------------------------------------------------------------------------

namespace Copperfield
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;

    /// <summary>
    /// Filters a decorated class as only able to satisfy certain values of a specific context type
    /// </summary>
    [SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification = "Value parameter is reflected in the Values property")]
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public sealed class PluggableForAttribute : ContextFilterAttribute
    {
        /// <summary>
        /// Initializes a new instance of the PluggableForAttribute class
        /// </summary>
        /// <param name="value">The filter value</param>
        public PluggableForAttribute(object value)
            : base(value.GetType(), value, false)
        {
        }

        /// <summary>
        /// Initializes a new instance of the PluggableForAttribute class
        /// </summary>
        /// <param name="values">The filter values</param>
        public PluggableForAttribute(params object[] values)
            : base(values.First().GetType(), values, false)
        {
        }
    }
}
